package es.deusto.ingenieria.aike.time;

import es.deusto.ingenieria.aike.csp.algorithm.BackTracking;

public class MainProgram {

	public static void main(String[] args) {
		try {						
			EnvironmentXMLReader environmentSAXParser = new EnvironmentXMLReader("data/equationMinSec-3.xml");
			Environment env = (Environment)environmentSAXParser.getInformation();
			TimeProblem problem = new TimeProblem(env);
			BackTracking<Integer> backTracking = new BackTracking<Integer>();			
			NodeConsistency nodeConsistency = new NodeConsistency(problem.getVariables(),env);
			if (nodeConsistency.makeConsistent())
			{
				System.out.println("The CSP Problem is unsolvable");
			}
			else
			{
				System.out.println("Is possible to solve the problem");
				problem.addVariables(nodeConsistency.getVariables());
				problem.solve(backTracking);			
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}
}